<template>
    <div id="personalInformationDetails" class="person-detail">
            <div>
               <van-nav-bar
                    title="个人信息"
                    :fixed="true"
                    left-arrow
                    @click-left="onClickLeft"
                 />
            </div>
            <div >
                <van-cell-group>
                    <van-cell :center="true" is-link @click.native="goav(detailsList[0].value)" class="first-cell">
                        <template slot="title">
                            <span class="custom-text">{{detailsList[0].label}}</span>
                            <img :src="detailsList[0].value" alt="" style="width:2em;height:2em;border-radius:50%;display: block;float: right;"/>
                        </template>
                    </van-cell>
                    <van-cell :title="detailsList[1].label" :value="detailsList[1].value" :center="true" is-link @click.native="toNickName()"/>
                    <!-- <van-cell :center="true" is-link to="/person/nickname">
                         <template slot="title">
                            <span class="custom-text">{{detailsList[2].label}}</span>
                            <img :src="detailsList[2].value" alt="" style="width:2em;height:2em;border-radius:50%;display: block;float: right;"/> 
                            <svg-icon :icon-class="detailsList[2].value" widthW="2em" heightH="2em" style="float: right;"></svg-icon>
                        </template>
                    </van-cell> -->
                    <van-cell :title="detailsList[2].label" :center="true" is-link to="/person/myHouses"/>
                    <van-cell :title="detailsList[3].label" :center="true" is-link to="/person/securityCenter"/>
                </van-cell-group>
            </div>
    </div>
</template>
<script>
import mine from "../../../controller/mine";
export default {
    name: 'Mine',
    components: {},
    data() {
        return {
            detailsList:[
                {
                    label : '头像',
                    value:''
                },
                {
                    label : '昵称',
                    value: '',
                }
                //,
                // {
                //     label : '二维码',
                //     value: '@/assets/police.jpeg',
                // }
                ,
                {
                    label : '我的房屋',
                    value: '',
                }
                ,
                {
                    label : '账号与安全',
                    value: '',
                }
            ]
        }
    },
    computed: {
        
    },
    created() {
        },
    mounted() {
        this.getUSerInfo()
    },
    methods: {
        goav(val){
            this.$router.push({path:'/person/avatar',query:{id:val}})
        },
        getUSerInfo(){
             mine.user_v1_findOwn().then(res=>{
                if(res.code === '0'){
                    this.detailsList[0].value = res.datas.headImg
                    this.detailsList[1].value = res.datas.username 
                    //this.detailsList[2].value = res.datas.username 
                }else{
                    this.$toast(res.msg)
                }
            })
        },
        toNickName(){
             this.$router.push({path: "/person/nickname", query: {"id": this.detailsList[1].value}})
        },
        chooseAddress(){
            this.show = true
        },
        onClickLeft(){
            this.$router.push({ path:'/home/mine'})
        },
        confirm(val){
            this.show = false
            this.area = val
            this.SET_ADDRESS(val[0].name)
        },
        cancel(){
            this.show = false
        }
    }
}
</script>
<style lang="scss" scoped>
@import '../style/index.scss';
.van-cell{
    border-bottom: 0.02667rem solid #EDEFF2;
}
</style>
